Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Save AmountInput changes on unmount #1883

Conversation

joel-jeremy
Copy link
Contributor

@joel-jeremy joel-jeremy commented Nov 8, 2023

Fix AmountInput change not being saved when another editable field is clicked while editing.

Steps to reproduce:

  1. Edit a category's budget
  2. Click on another category budget or any category name

Copy link

netlify bot commented Nov 8, 2023

Deploy Preview for actualbudget ready!

Name Link
🔨 Latest commit 1f2f73b
🔍 Latest deploy log https://app.netlify.com/sites/actualbudget/deploys/654c192285bd3d00084f7f8b
😎 Deploy Preview https://deploy-preview-1883.demo.actualbudget.org
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

Copy link
Contributor

github-actions bot commented Nov 8, 2023

Bundle Stats — desktop-client

Hey there, this message comes from a GitHub action that helps you and reviewers to understand how these changes affect the size of this project's bundle.

As this PR is updated, I'll keep you updated on how the bundle size is impacted.

Total

Files count Total bundle size % Changed
16 2.83 MB → 2.83 MB (+61 B) +0.00%
Changeset
File Δ Size
src/components/util/AmountInput.js 📈 +284 B (+6.58%) 4.22 kB → 4.5 kB
View detailed bundle breakdown

Added

No assets were added

Removed

No assets were removed

Bigger

Asset File Size % Changed
static/js/main.js 1.12 MB → 1.12 MB (+61 B) +0.01%

Smaller

No assets were smaller

Unchanged

Asset File Size % Changed
static/js/848.chunk.js 760.98 kB 0%
static/media/Inter-italic.var.woff2 239.29 kB 0%
static/media/Inter-roman.var.woff2 221.86 kB 0%
static/js/444.chunk.js 156.11 kB 0%
static/js/wide-components.chunk.js 127 kB 0%
static/js/231.chunk.js 117.37 kB 0%
static/js/narrow-components.chunk.js 52.15 kB 0%
static/js/reports.chunk.js 29.97 kB 0%
static/js/473.chunk.js 13 kB 0%
static/js/312.chunk.js 12.78 kB 0%
static/js/resize-observer-polyfill.chunk.js 8.88 kB 0%
static/css/main.css 7.41 kB 0%
asset-manifest.json 2.07 kB 0%
index.html 1.66 kB 0%
static/media/browser-server.js 903 B 0%

Copy link
Contributor

github-actions bot commented Nov 8, 2023

Bundle Stats — loot-core

Hey there, this message comes from a GitHub action that helps you and reviewers to understand how these changes affect the size of this project's bundle.

As this PR is updated, I'll keep you updated on how the bundle size is impacted.

Total

Files count Total bundle size % Changed
2 2.22 MB 0%

Changeset

No files were changed

View detailed bundle breakdown

Added

No assets were added

Removed

No assets were removed

Bigger

No assets were bigger

Smaller

No assets were smaller

Unchanged

Asset File Size % Changed
kcab.worker.js 1.23 MB 0%
xfo.xfo.kcab.worker.js 1014.46 kB 0%

@@ -59,6 +59,15 @@ export function AmountInput({
}
}

// Save changes when the component unmounts.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💭 thought: ‏I'm afraid this won't be that simple.

Currently fireChange will trigger whenever value !== initialValue. Not just on unmount. So you'll be triggering much more events than expected.

What you actually want is to trigger the onBlur event when unmounting the Input component. But that's not really straight-forward.

See the thread here: facebook/react#12363

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I read that issue and tried the display: none solution. It worked on other parts of the codebase but for some reason when used here, the value state is always zero.

@joel-jeremy
Copy link
Contributor Author

Superceded by #1965

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants